package com.vvlive.caibao.smartcity.felm;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by lenovo on 2015/6/29.
 * 用于生活页外卖列表左列表
 */
public class LifefelmAdapter extends BaseAdapter {
    private Context mContext;
    private String[] mString;

    public LifefelmAdapter(Context context, String[] str) {
        mContext = context;
        this.mString = str;
    }

    @Override
    public int getCount() {
        return mString.length;
    }

    @Override
    public Object getItem(int position) {
        return mString[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.life_item_yijuhua_list, null);
            viewHolder = new ViewHolder();
            viewHolder.mTextView = (TextView) convertView.findViewById(R.id.life_yijuhua);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.mTextView.setText(mString[position]);
        viewHolder.mTextView.setTextColor(Color.BLACK);
        convertView.setBackgroundColor(Color.TRANSPARENT);
        return convertView;
    }

    static class ViewHolder {
        public TextView mTextView;
    }
}
